﻿using System;
using System.Linq;

namespace NerdDinnerDataComponent
{
    public partial class Dinner
    {
        public bool IsHostedBy(string userName)
        {
            return HostedBy.Equals(userName,
                                   StringComparison.OrdinalIgnoreCase);
        }

        public bool IsUserRegistered(string userName)
        {
            return RSVPs.Any(r => r.AttendeeName.Equals(userName, StringComparison.OrdinalIgnoreCase));
        }
    }
}